<template>
  <div id="index" ref="appRef">
    <div class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <div v-else class="host-body">
        <div class="d-flex jc-center">
          <dv-decoration-10 class="dv-dec-10" />
          <div class="d-flex jc-center">
            <dv-decoration-8 class="dv-dec-8" :color="decorationColors" />
            <div class="title">
              <!-- 使用获取到的 title 参数替换原标题 -->
              <span class="title-text">{{titlevalue}}人事{{dataText}}概览</span>
              <dv-decoration-6
                class="dv-dec-6"
                :reverse="true"
                :color="['#50e3c2', '#67a1e5']"
              />
            </div>
            <dv-decoration-8
              class="dv-dec-8"
              :reverse="true"
              :color="decorationColors"
            />
          </div>
          <dv-decoration-10 class="dv-dec-10-s" />
        </div>
        <!-- 第二行 -->
        <div class="d-flex jc-between px-2">
          <div class="d-flex aside-width">
            <div class="react-left ml-4 react-l-s">
              <span class="react-before"></span>
              <span class="text" @click="goToHomePage">返回首页</span>
              <span class="text" @click="goToPuJiangPersonnePage">浦江</span>
              <span class="text" @click="goToFenYangPersonnePage">汾阳</span>
            </div>
            <div class="react-left ml-3" style=" width:260px;">
              <span class="text">{{ subtitle[1] }}</span>
            </div>
          </div>
          <div class="d-flex aside-width">
            <div class="react-right mr-3" style="background-color: #0f1325;width:250px;" > 
              <span class="text fw-b">{{ subtitle[2]}}</span>
            </div>
            <div class="react-right mr-4 react-l-s">
              <span class="react-after"></span>
              <span class="text">
                {{ timeInfo.dateYear }} {{ timeInfo.dateWeek }}
                {{ timeInfo.dateDay }}
              </span>
            </div>
          </div>
        </div>
        <div class="body-box">
          <CapsuleBarChartView
           v-for="index in 18"
            :key="index"
            :title="getPieTitle(index)"
            :PieIndex=index
            :piedata=GetChangeData(index)
          />
        </div>
      </div>
    </div>
  </div>
</template>
  
<script lang="ts">
import { defineComponent, ref, reactive, onMounted, onUnmounted, getCurrentInstance, computed } from "vue";
import { useRoute } from "vue-router"; // 引入 useRoute
import { formatTime } from "@/utils/index";
import { WEEK } from "@/constant/index";
import useDraw from "@/utils/useDraw";
import { title, subtitle, moduleInfo } from "@/constant/index";
import { RouterLink, RouterView } from "vue-router";
import CapsuleBarChartView from "@/views/NurseStaffInformation/FengYnagPersonnelInfoCapsuleBarChartView/CapsuleBarChart.vue";

export default defineComponent({
  components: {
      CapsuleBarChartView
  },
  setup() {
      const route = useRoute(); // 使用 useRoute 获取当前路由信息
      const titlevalue = computed(() => {
          return route.query.CapsuleBarChartTitle as string || '';
      });
      const dataText = computed(() => {
          return route.query.DataContent as string || '';
      });
    // * 颜色
    const decorationColors = ["#568aea", "#000000"];
    // * 加载标识
    const loading = ref<boolean>(true);
    // * 时间内容
    const timeInfo = reactive({
      setInterval: 0,
      dateDay: "",
      dateYear: "",
      dateWeek: "",
    });
    // * 适配处理
    const { appRef, calcRate, windowDraw, unWindowDraw } = useDraw();
    // 生命周期
    onMounted(() => {
      cancelLoading();
      handleTime();
      // todo 屏幕适应
      windowDraw();
      calcRate();
    });

    onUnmounted(() => {
      unWindowDraw();
      clearInterval(timeInfo.setInterval);
    });

    // methods
    // todo 处理 loading 展示
    const cancelLoading = () => {
      setTimeout(() => {
        loading.value = false;
      }, 500);
    };

    // todo 处理时间监听
    const handleTime = () => {
      timeInfo.setInterval = setInterval(() => {
        const date = new Date();
        timeInfo.dateDay = formatTime(date, "HH: mm: ss");
        timeInfo.dateYear = formatTime(date, "yyyy-MM-dd");
        timeInfo.dateWeek = WEEK[date.getDay()];
      }, 1000);
    };
    const getPieTitle = (num: number) => {
    let result = "";
    switch (num) {
      case 1:
        result = '护理部';
        break;
         case 2:
        result = '一病区';
        break;
         case 3:
        result = '二病区';
        break;
         case 4:
        result = '三病区';
        break;
         case 5:
        result = '四病区';
        break;
         case 6:
        result = '特需病区';
        break;
         case 7:
        result = '八病区';
        break;
         case 8:
        result = '术后观察室';
        break;
        case 9:
        result = '急诊室';
        break;
        case 10:
        result = '眼门诊';
        break;
        case 11:
        result = '耳门诊';
        break;
        case 12:
        result = '特需门诊';
        break;
        case 13:
        result = '手术室';
        break;
        case 14:
        result = '供应室';
        break;
        case 15:
        result = '视光学';
        break;
        case 16:
        result = '临床科研助理';
        break;
        case 17:
        result = '十七病区';
        break;
        case 18:
        result = '二十病区';
        break;
        default:
        result='';
        break;
    }
    return result;
  };
     const getChineseNumber = (num: number) => {
      let result = '';
      switch (num) {
        case 1:
          result = '一病区';
          break;
           case 2:
          result = '三病区';
          break;
           case 3:
          result = '四病区';
          break;
           case 4:
          result = '八病区';
          break;
           case 5:
          result = '特需病区';
          break;
           case 6:
          result = '二十二病区';
          break;
           case 7:
          result = '监护病区';
          break;
           case 8:
          result = '十七病区';
          break;
            case 9:
          result = '二十病区';
          break;
          default:
          result='';
          break;
      }
      return result;
    };

    //获取学历数据
    const  getEducationlevelData=(num: number) => 
    {
      let pieData=[];
      switch (num) {
      case 1:
      pieData =  [
      {
        name: "博士",
        value: 2,
      }
      ,
      {
        name: "硕士",
        value: 4,
      }
      ,{
        name: "本科",
        value: 10,
      },
      {
        name: "大专",
        value: 20,
      }
      ]
        break;
        case 2:
      pieData =  [
      {
        name: "博士",
        value: 3,
      }
      ,
      {
        name: "硕士",
        value: 5,
      }
      ,{
        name: "本科",
        value: 12,
      },
      {
        name: "大专",
        value: 25,
      }
      ]
        break;
        case 3:
      pieData =  [
      {
        name: "博士",
        value: 6,
      }
      ,
      {
        name: "硕士",
        value: 8,
      }
      ,{
        name: "本科",
        value: 15,
      },
      {
        name: "大专",
        value: 30,
      }
      ]
        break;
        case 4:
      pieData = [
      {
        name: "博士",
        value:4,
      }
      ,
      {
        name: "硕士",
        value:7,
      }
      ,{
        name: "本科",
        value: 9,
      },
      {
        name: "大专",
        value: 11,
      }
      ]
        break;
        case 5:
      pieData =  [
      {
        name: "博士",
        value:8,
      }
      ,
      {
        name: "硕士",
        value: 14,
      }
      ,{
        name: "本科",
        value: 18,
      },
      {
        name: "大专",
        value: 28,
      }
      ]
        break;
        case 6:
      pieData =  [
      {
        name: "博士",
        value: 10,
      }
      ,
      {
        name: "硕士",
        value: 20,
      }
      ,{
        name: "本科",
        value: 30,
      },
      {
        name: "大专",
        value: 40,
      }
      ]
        break;
        case 7:
      pieData =  [
      {
        name: "博士",
        value:8,
      }
      ,
      {
        name: "硕士",
        value: 16,
      }
      ,{
        name: "本科",
        value: 32,
      },
      {
        name: "大专",
        value: 64,
      }
      ]
        break;
        case 8:
      pieData =  [
      {
        name: "博士",
        value:11,
      }
      ,
      {
        name: "硕士",
        value:17,
      }
      ,{
        name: "本科",
        value: 23,
      },
      {
        name: "大专",
        value: 35,
      }
      ]
        break;
        case 9:
      pieData =  
      [
      {
        name: "博士",
        value: 2,
      }
      ,
      {
        name: "硕士",
        value: 4,
      }
      ,{
        name: "本科",
        value: 10,
      },
      {
        name: "大专",
        value: 20,
      }
      ]
        break;
        case 10:
      pieData =  [
      {
        name: "博士",
        value: 22,
      }
      ,
      {
        name: "硕士",
        value: 44,
      }
      ,{
        name: "本科",
        value: 55,
      },
      {
        name: "大专",
        value: 66,
      }
      ]
        break;
        case 11:
      pieData =  [
      {
        name: "博士",
        value:3,
      }
      ,
      {
        name: "硕士",
        value:12,
      }
      ,{
        name: "本科",
        value: 24,
      },
      {
        name: "大专",
        value: 31,
      }
      ]
        break;
        case 12:
      pieData =  [
      {
        name: "博士",
        value:5,
      }
      ,
      {
        name: "硕士",
        value:17,
      }
      ,{
        name: "本科",
        value: 26,
      },
      {
        name: "大专",
        value: 37,
      }
      ]
        break;
        case 13:
      pieData =  [
      {
        name: "博士",
        value:5,
      }
      ,
      {
        name: "硕士",
        value: 15,
      }
      ,{
        name: "本科",
        value: 34,
      },
      {
        name: "大专",
        value: 47,
      }
      ]
        break;
        case 14:
      pieData =  [
      {
        name: "博士",
        value: 7,
      }
      ,
      {
        name: "硕士",
        value: 16,
      }
      ,{
        name: "本科",
        value: 18,
      },
      {
        name: "大专",
        value: 29,
      }
      ]
        break;
        case 15:
      pieData =  [
      {
        name: "博士",
        value: 9,
      }
      ,
      {
        name: "硕士",
        value: 10,
      }
      ,{
        name: "本科",
        value: 27,
      },
      {
        name: "大专",
        value: 43,
      }
      ]
        break;
        case 16:
      pieData =  [
      {
        name: "博士",
        value: 15,
      }
      ,
      {
        name: "硕士",
        value: 20,
      }
      ,{
        name: "本科",
        value: 25,
      },
      {
        name: "大专",
        value: 30,
      }
      ]
        break;
        case 17:
      pieData =  [
      {
        name: "博士",
        value: 16,
      }
      ,
      {
        name: "硕士",
        value: 26,
      }
      ,{
        name: "本科",
        value: 36,
      },
      {
        name: "大专",
        value: 46,
      }
      ]
        break;
        case 18:
      pieData =  [
      {
        name: "博士",
        value: 13,
      }
      ,
      {
        name: "硕士",
        value: 24,
      }
      ,{
        name: "本科",
        value: 30,
      },
      {
        name: "大专",
        value: 50,
      }
      ]
        break;
        default:
        pieData=[];
          break;
      }
      return pieData;
    }
 //获取职称数据
    const  getTitleData=(num: number) => 
    {
      let pieData=[];
      switch (num) {
        case 1:
      pieData =  [
      {
        name: "主任护师",
        value: 2,
      },
      {
        name: "主管护士",
        value: 4,
      },
      {
        name: "副主任护士",
        value: 10,
      },
      {
        name: "护士",
        value: 20,
      }
      ];
        break;
        case 2:
      pieData =  [
      {
        name: "主任护师",
        value: 3,
      },
      {
        name: "主管护士",
        value: 5,
      },
      {
        name: "副主任护士",
        value: 12,
      },
      {
        name: "护士",
        value: 25,
      }
      ];
        break;
        case 3:
      pieData =  [
      {
        name: "主任护师",
        value: 6,
      },
      {
        name: "主管护士",
        value: 8,
      },
      {
        name: "副主任护士",
        value: 15,
      },
      {
        name: "护士",
        value: 30,
      }
      ];
        break;
        case 4:
      pieData = [
      {
        name: "主任护师",
        value:4,
      },
      {
        name: "主管护士",
        value:7,
      },
      {
        name: "副主任护士",
        value: 9,
      },
      {
        name: "护士",
        value: 11,
      }
      ];
        break;
        case 5:
      pieData =  [
      {
        name: "主任护师",
        value:8,
      },
      {
        name: "主管护士",
        value: 14,
      },
      {
        name: "副主任护士",
        value: 18,
      },
      {
        name: "护士",
        value: 28,
      }
      ];
        break;
        case 6:
      pieData =  [
      {
        name: "主任护师",
        value: 10,
      },
      {
        name: "主管护士",
        value: 20,
      },
      {
        name: "副主任护士",
        value: 30,
      },
      {
        name: "护士",
        value: 40,
      }
      ];
        break;
        case 7:
      pieData =  [
      {
        name: "主任护师",
        value:8,
      },
      {
        name: "主管护士",
        value: 16,
      },
      {
        name: "副主任护士",
        value: 32,
      },
      {
        name: "护士",
        value: 64,
      }
      ];
        break;
        case 8:
      pieData =  [
      {
        name: "主任护师",
        value:11,
      },
      {
        name: "主管护士",
        value:17,
      },
      {
        name: "副主任护士",
        value: 23,
      },
      {
        name: "护士",
        value: 35,
      }
      ];
        break;
        case 9:
      pieData =  
      [
      {
        name: "主任护师",
        value: 2,
      },
      {
        name: "主管护士",
        value: 4,
      },
      {
        name: "副主任护士",
        value: 10,
      },
      {
        name: "护士",
        value: 20,
      }
      ];
        break;
        case 10:
      pieData =  [
      {
        name: "主任护师",
        value: 22,
      },
      {
        name: "主管护士",
        value: 44,
      },
      {
        name: "副主任护士",
        value: 55,
      },
      {
        name: "护士",
        value: 66,
      }
      ];
        break;
        case 11:
      pieData =  [
      {
        name: "主任护师",
        value:3,
      },
      {
        name: "主管护士",
        value:12,
      },
      {
        name: "副主任护士",
        value: 24,
      },
      {
        name: "护士",
        value: 31,
      }
      ];
        break;
        case 12:
      pieData =  [
      {
        name: "主任护师",
        value:5,
      },
      {
        name: "主管护士",
        value:17,
      },
      {
        name: "副主任护士",
        value: 26,
      },
      {
        name: "护士",
        value: 37,
      }
      ];
        break;
        case 13:
      pieData =  [
      {
        name: "主任护师",
        value:5,
      },
      {
        name: "主管护士",
        value: 15,
      },
      {
        name: "副主任护士",
        value: 34,
      },
      {
        name: "护士",
        value: 47,
      }
      ];
        break;
        case 14:
      pieData =  [
      {
        name: "主任护师",
        value: 7,
      },
      {
        name: "主管护士",
        value: 16,
      },
      {
        name: "副主任护士",
        value: 32,
      },
      {
        name: "护士",
        value: 64,
      }
      ];
      break;
        case 15:
      pieData =  [
      {
        name: "主任护师",
        value: 1,
      },
      {
        name: "主管护士",
        value: 4,
      },
      {
        name: "副主任护士",
        value: 8,
      },
      {
        name: "护士",
        value: 30,
      }
      ];
      break;
        case 16:
      pieData =  [
      {
        name: "主任护师",
        value: 1,
      },
      {
        name: "主管护士",
        value: 5,
      },
      {
        name: "副主任护士",
        value: 6,
      },
      {
        name: "护士",
        value: 35,
      }
      ];
      break;
        case 17:
      pieData =  [
      {
        name: "主任护师",
        value: 1,
      },
      {
        name: "主管护士",
        value: 3,
      },
      {
        name: "副主任护士",
        value: 5,
      },
      {
        name: "护士",
        value: 27,
      }
      ];
      break;
        case 18:
      pieData =  [
      {
        name: "主任护师",
        value: 1,
      },
      {
        name: "主管护士",
        value: 5,
      },
      {
        name: "副主任护士",
        value: 8,
      },
      {
        name: "护士",
        value: 34,
      }
      ];
        break;
        default:
        pieData=[];
          break;
      }
      return pieData;
    }
 //获取能级数据
 const getEnergylevelData = (num: number) => {
    let pieData = [];
    switch (num) {
        case 1:
            pieData = [
                {
                    name: "N0",
                    value: 2,
                },
                {
                    name: "N1",
                    value: 4,
                },
                {
                    name: "N2",
                    value: 10,
                },
                {
                    name: "N3",
                    value: 20,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 2:
            pieData = [
                {
                    name: "N0",
                    value: 3,
                },
                {
                    name: "N1",
                    value: 5,
                },
                {
                    name: "N2",
                    value: 12,
                },
                {
                    name: "N3",
                    value: 25,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 3:
            pieData = [
                {
                    name: "N0",
                    value: 6,
                },
                {
                    name: "N1",
                    value: 8,
                },
                {
                    name: "N2",
                    value: 15,
                },
                {
                    name: "N3",
                    value: 30,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 4:
            pieData = [
                {
                    name: "N0",
                    value: 4,
                },
                {
                    name: "N1",
                    value: 7,
                },
                {
                    name: "N2",
                    value: 9,
                },
                {
                    name: "N3",
                    value: 11,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 5:
            pieData = [
                {
                    name: "N0",
                    value: 8,
                },
                {
                    name: "N1",
                    value: 14,
                },
                {
                    name: "N2",
                    value: 18,
                },
                {
                    name: "N3",
                    value: 28,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 6:
            pieData = [
                {
                    name: "N0",
                    value: 10,
                },
                {
                    name: "N1",
                    value: 20,
                },
                {
                    name: "N2",
                    value: 30,
                },
                {
                    name: "N3",
                    value: 40,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 7:
            pieData = [
                {
                    name: "N0",
                    value: 8,
                },
                {
                    name: "N1",
                    value: 16,
                },
                {
                    name: "N2",
                    value: 32,
                },
                {
                    name: "N3",
                    value: 64,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 8:
            pieData = [
                {
                    name: "N0",
                    value: 11,
                },
                {
                    name: "N1",
                    value: 17,
                },
                {
                    name: "N2",
                    value: 23,
                },
                {
                    name: "N3",
                    value: 35,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 9:
            pieData = [
                {
                    name: "N0",
                    value: 2,
                },
                {
                    name: "N1",
                    value: 4,
                },
                {
                    name: "N2",
                    value: 10,
                },
                {
                    name: "N3",
                    value: 20,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 10:
            pieData = [
                {
                    name: "N0",
                    value: 22,
                },
                {
                    name: "N1",
                    value: 44,
                },
                {
                    name: "N2",
                    value: 55,
                },
                {
                    name: "N3",
                    value: 66,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 11:
            pieData = [
                {
                    name: "N0",
                    value: 3,
                },
                {
                    name: "N1",
                    value: 12,
                },
                {
                    name: "N2",
                    value: 24,
                },
                {
                    name: "N3",
                    value: 31,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 12:
            pieData = [
                {
                    name: "N0",
                    value: 5,
                },
                {
                    name: "N1",
                    value: 17,
                },
                {
                    name: "N2",
                    value: 26,
                },
                {
                    name: "N3",
                    value: 37,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 13:
            pieData = [
                {
                    name: "N0",
                    value: 5,
                },
                {
                    name: "N1",
                    value: 15,
                },
                {
                    name: "N2",
                    value: 34,
                },
                {
                    name: "N3",
                    value: 47,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 14:
            pieData = [
                {
                    name: "N0",
                    value: 7,
                },
                {
                    name: "N1",
                    value: 16,
                },
                {
                    name: "N2",
                    value: 18,
                },
                {
                    name: "N3",
                    value: 29,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 15:
            pieData = [
                {
                    name: "N0",
                    value: 9,
                },
                {
                    name: "N1",
                    value: 10,
                },
                {
                    name: "N2",
                    value: 27,
                },
                {
                    name: "N3",
                    value: 43,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 16:
            pieData = [
                {
                    name: "N0",
                    value: 15,
                },
                {
                    name: "N1",
                    value: 20,
                },
                {
                    name: "N2",
                    value: 25,
                },
                {
                    name: "N3",
                    value: 30,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 17:
            pieData = [
                {
                    name: "N0",
                    value: 16,
                },
                {
                    name: "N1",
                    value: 26,
                },
                {
                    name: "N2",
                    value: 36,
                },
                {
                    name: "N3",
                    value: 46,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        case 18:
            pieData = [
                {
                    name: "N0",
                    value: 13,
                },
                {
                    name: "N1",
                    value: 24,
                },
                {
                    name: "N2",
                    value: 30,
                },
                {
                    name: "N3",
                    value: 50,
                },
                {
                    name: "N4",
                    value: 10,
                },
                {
                    name: "护士长人数",
                    value: 20,
                }
            ];
            break;
        default:
            pieData = [];
            break;
    }
    return pieData;
};
 //获取工作年限数据
 const getRestsData = (num: number) => {
    let pieData = [];
    switch (num) {
        case 1:
            pieData = [
                {
                    name: "<1",
                    value: 2,
                },
                {
                    name: "1<=y<2",
                    value: 4,
                },
                {
                    name: "2<=y<5",
                    value: 10,
                },
                {
                    name: "5<=y<10",
                    value: 20,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 2:
            pieData = [
                {
                    name: "<1",
                    value: 3,
                },
                {
                    name: "1<=y<2",
                    value: 5,
                },
                {
                    name: "2<=y<5",
                    value: 12,
                },
                {
                    name: "5<=y<10",
                    value: 25,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 3:
            pieData = [
                {
                    name: "<1",
                    value: 6,
                },
                {
                    name: "1<=y<2",
                    value: 8,
                },
                {
                    name: "2<=y<5",
                    value: 15,
                },
                {
                    name: "5<=y<10",
                    value: 30,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 4:
            pieData = [
                {
                    name: "<1",
                    value: 4,
                },
                {
                    name: "1<=y<2",
                    value: 7,
                },
                {
                    name: "2<=y<5",
                    value: 9,
                },
                {
                    name: "5<=y<10",
                    value: 11,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 5:
            pieData = [
                {
                    name: "<1",
                    value: 8,
                },
                {
                    name: "1<=y<2",
                    value: 14,
                },
                {
                    name: "2<=y<5",
                    value: 18,
                },
                {
                    name: "5<=y<10",
                    value: 28,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 6:
            pieData = [
                {
                    name: "<1",
                    value: 10,
                },
                {
                    name: "1<=y<2",
                    value: 20,
                },
                {
                    name: "2<=y<5",
                    value: 30,
                },
                {
                    name: "5<=y<10",
                    value: 40,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 7:
            pieData = [
                {
                    name: "<1",
                    value: 8,
                },
                {
                    name: "1<=y<2",
                    value: 16,
                },
                {
                    name: "2<=y<5",
                    value: 32,
                },
                {
                    name: "5<=y<10",
                    value: 64,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 8:
            pieData = [
                {
                    name: "<1",
                    value: 11,
                },
                {
                    name: "1<=y<2",
                    value: 17,
                },
                {
                    name: "2<=y<5",
                    value: 23,
                },
                {
                    name: "5<=y<10",
                    value: 35,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 9:
            pieData = [
                {
                    name: "<1",
                    value: 2,
                },
                {
                    name: "1<=y<2",
                    value: 4,
                },
                {
                    name: "2<=y<5",
                    value: 10,
                },
                {
                    name: "5<=y<10",
                    value: 20,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 10:
            pieData = [
                {
                    name: "<1",
                    value: 22,
                },
                {
                    name: "1<=y<2",
                    value: 44,
                },
                {
                    name: "2<=y<5",
                    value: 55,
                },
                {
                    name: "5<=y<10",
                    value: 66,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 11:
            pieData = [
                {
                    name: "<1",
                    value: 3,
                },
                {
                    name: "1<=y<2",
                    value: 12,
                },
                {
                    name: "2<=y<5",
                    value: 24,
                },
                {
                    name: "5<=y<10",
                    value: 31,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 12:
            pieData = [
                {
                    name: "<1",
                    value: 5,
                },
                {
                    name: "1<=y<2",
                    value: 17,
                },
                {
                    name: "2<=y<5",
                    value: 26,
                },
                {
                    name: "5<=y<10",
                    value: 37,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 13:
            pieData = [
                {
                    name: "<1",
                    value: 5,
                },
                {
                    name: "1<=y<2",
                    value: 15,
                },
                {
                    name: "2<=y<5",
                    value: 34,
                },
                {
                    name: "5<=y<10",
                    value: 47,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 14:
            pieData = [
                {
                    name: "<1",
                    value: 7,
                },
                {
                    name: "1<=y<2",
                    value: 16,
                },
                {
                    name: "2<=y<5",
                    value: 18,
                },
                {
                    name: "5<=y<10",
                    value: 29,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 15:
            pieData = [
                {
                    name: "<1",
                    value: 9,
                },
                {
                    name: "1<=y<2",
                    value: 10,
                },
                {
                    name: "2<=y<5",
                    value: 27,
                },
                {
                    name: "5<=y<10",
                    value: 43,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 16:
            pieData = [
                {
                    name: "<1",
                    value: 15,
                },
                {
                    name: "1<=y<2",
                    value: 20,
                },
                {
                    name: "2<=y<5",
                    value: 25,
                },
                {
                    name: "5<=y<10",
                    value: 30,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 17:
            pieData = [
                {
                    name: "<1",
                    value: 16,
                },
                {
                    name: "1<=y<2",
                    value: 26,
                },
                {
                    name: "2<=y<5",
                    value: 36,
                },
                {
                    name: "5<=y<10",
                    value: 46,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        case 18:
            pieData = [
                {
                    name: "<1",
                    value: 13,
                },
                {
                    name: "1<=y<2",
                    value: 24,
                },
                {
                    name: "2<=y<5",
                    value: 30,
                },
                {
                    name: "5<=y<10",
                    value: 50,
                },
                {
                    name: "10<=y<20",
                    value: 10,
                },
                {
                    name: ">=20",
                    value: 20,
                }
            ];
            break;
        default:
            pieData = [];
            break;
    }
    return pieData;
};

   const GetChangeData = (num: number) =>{
    switch (dataText.value) {
      case "学历":
      return getEducationlevelData(num);
        break;
        case "职称":
        return getTitleData(num);
        break;
        case "能级":
        return  getEnergylevelData(num);
        break;
        case "工作年限":
        return getRestsData(num);
        break;
        default:
           return [];
          break;
    }

   }


    return {
      loading,
      timeInfo,
      appRef,
      title,
      subtitle,
      moduleInfo,
      getChineseNumber,
      getPieTitle,
      decorationColors,
      titlevalue,
      dataText,
      getEducationlevelData,
      GetChangeData
    };
  },
  methods: {
    goToHomePage() {
      this.$router.push({ name: "Index" });
    },
    goToPuJiangPersonnePage()
    {
      this.$router.push({ name: "PuJiangPersonne" });
    },
    goToFenYangPersonnePage()
    {
      this.$router.push({ name: "FenYangPersonne" });
    },
  },
});
</script>
  
  <style lang="scss" scoped>
@import "Css/CapsuleBarChart.scss";
</style>